package com.xinwei.constant;


import com.xinwei.excpetion.ManagerException;
import com.xinwei.excpetion.ManagerExceptionEnmu;

public class Status {
    public static final boolean SUCCESS = true;

    public static final boolean ERROR = false;

    public enum ClassEnum{
        ONE(1,"机械电子工程(创新班)19(1)"),
        TWO(2,"机械电子工程19(1)"),
        THREE(3,"机械电子工程19(2)"),
        FOUR(4,"机械电子工程19(3)"),
        FIVE(5,"机械电子工程19(4)"),
        SIX(6,"机械设计制造及其自动化(卓越工程师班)19(1)"),
        SEVEN(7,"机械设计制造及其自动化19(1)"),
        EIGHT(8,"机械设计制造及其自动化19(2)"),
        NINE(9,"机械设计制造及其自动化19(3)"),
        TEN(10,"机械设计制造及其自动化19(4)"),
        ELEVEN(11,"机械设计制造及其自动化19(5)"),
        TWELVE(12,"机械设计制造及其自动化19(6)"),
        THIRTEEN(13,"车辆工程19(1)"),
        FOURTEEN(14,"车辆工程19(2)"),
        FIFTEEN(15,"测控技术与仪器19(1)"),
        SIXTEEN(16,"测控技术与仪器19(2)"),
        SEVENTEEN(17,"工业工程19(1)"),
        EIGHTEEN(18,"工业工程19(2)");

        private Integer code;
        private String value;

        ClassEnum(Integer code, String value) {
            this.code = code;
            this.value = value;
        }

        public static ClassEnum codeOf(int code){
            for (ClassEnum familyEconomyEnum : values()){
                if (familyEconomyEnum.getCode() == code){
                    return familyEconomyEnum;
                }
            }
            throw new ManagerException(ManagerExceptionEnmu.NO_ENMU);
        }

        public static ClassEnum nameOf(String name){
            for (ClassEnum familyEconomyEnum : values()){
                if (familyEconomyEnum.getValue().equals(name)){
                    return familyEconomyEnum;
                }
            }
            throw new ManagerException(ManagerExceptionEnmu.ERROR_CLASS_NAME);
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }
    }
}
